import { ProCard } from "@ant-design/pro-components";
import { Affix, Breadcrumb, Tabs } from "antd";
import { NavLink, useDispatch, useSelector } from "umi";
import styles from "./styles.less";


//组件引入 
import System from "./comment/system"  //系统设置
import Internationalization from "./comment/internationalization"  //国际化设置
import SEOset from "./comment/SEOset"  //SEO设置
import DataSetting from "./comment/DataSetting"  //数据统计
import OSSset from "./comment/OSSset"  //OSS设置
import Serve from "./comment/serve"  //SMTP服务
import { useEffect } from "react";


export default function Index() {
  const { TabPane } = Tabs; //组件引入
  const Dispatch = useDispatch()
  useEffect(() => {
    Dispatch({
      type: "settings/getting"
    })
    console.log(2);
    
  }, [])
  const { InitialValue } = useSelector((state: { settings: any }) => {
    return state.settings
  });
  // console.log(InitialValue);

  return (
    <div className={styles.serring}>
      <div className={styles.header}>
        <Affix>
          <ProCard >
            <Breadcrumb>
              <Breadcrumb.Item><NavLink to='/home'>工作台</NavLink></Breadcrumb.Item>
              <Breadcrumb.Item><NavLink to='/setting'>系统设置 </NavLink></Breadcrumb.Item>
              {/* <Breadcrumb.Item><NavLink to='/form/advanced-form'>标签管理 </NavLink></Breadcrumb.Item> */}
            </Breadcrumb>
          </ProCard>
        </Affix>
      </div>
      <div className={styles.main} >
        <Tabs defaultActiveKey="1" tabPosition="left">
          <TabPane tab="系统设置" key="1">
            <System InitialValue={InitialValue} />
          </TabPane>
          <TabPane tab="国际化设置" key="2">
            <Internationalization InitialValue={InitialValue}/>
          </TabPane>
          <TabPane tab="SEO设置" key="3">
            <SEOset InitialValue={InitialValue} />
          </TabPane>
          <TabPane tab="数据统计" key="4">
            <DataSetting InitialValue={InitialValue} />
          </TabPane>
          <TabPane tab="OSS设置" key="5">
            <OSSset InitialValue={InitialValue} />
          </TabPane>
          <TabPane tab="SMTP服务" key="6">
            <Serve InitialValue={InitialValue} />
          </TabPane>
        </Tabs>
      </div>
    </div>
  )
}
